home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Stickerpedia Stickerbook
/
Stickerbook.iso
/
pc
/
DATA
/
behaviours.cxt
/
00002_Script_ [ global ] Button
< prev
next >
Wrap
Text File
|
2003-03-23
|
3KB
|
167 lines
global oSpr
global gDontReact
global gCurrentCursor
property spriteNum
property pChangeCursor
property pUpstate
property pLeaveState
property pNoHilite
property pOriginalState
property pDisabled
property pIgnoreDontReact
on beginSprite me
pDisabled = 0
end
on disable me
-- this handler can be called to temporarily disable the script
-- for example from a handler which checks whether a text field is empty
pDisabled = 1
modify (oSpr, spriteNum, #std)
if rollover(spriteNum) then cursor -1
updatestage
end
on enterFrame me
-- put "gDontReact" && gDontReact
end
on enable me
-- this handler can be called to temporarily disable the script
-- for example from a handler which checks whether a text field is empty
pDisabled = 0
if rollover(spriteNum) then
cursor 280
modify (oSpr, spriteNum, #hiL)
updatestage
end if
end
on mouseEnter me
-- put "gDontReact" && gDontReact
-- put "pDisabled" && pDisabled
if (gDontReact OR pDisabled) and (not pIgnoreDontReact) then
exit
else
if pChangeCursor then
cursor 280
gCurrentCursor = 280
end if
if pNoHilite then exit
pOriginalState = getState (oSpr, spriteNum)
if pOriginalState = #sel then exit
modify (oSpr, spriteNum, #hil)
if pLeaveState = #asBefore then
pLeaveState = pOriginalState
end if
end if
end
on mouseLeave me
if (gDontReact OR pDisabled) and (not pIgnoreDontReact) then
exit
else
if pChangeCursor then
cursor -1
gCurrentCursor = -1
end if
if pNoHilite then exit
pOriginalState = getState (oSpr, spriteNum)
if pOriginalState = #sel then exit
modify oSpr, spriteNum, pLeaveState
end if
end
on mouseDown me, callingOption
if (gDontReact OR pDisabled) and (not pIgnoreDontReact) then
exit
else
pOriginalState = getState (oSpr, spriteNum)
if pOriginalState = #sel then exit
modify oSpr, spriteNum, #dwn
updatestage
repeat while the stillDown
end repeat
if callingOption = #withOutMouse then
modify oSpr, spriteNum, pUpstate
sendSprite spritenum, #msUp
else
if rollover(spriteNum) then
modify oSpr, spriteNum, pUpstate
sendSprite spritenum, #msUp
else
modify oSpr, spriteNum, pOriginalState
end if
end if
updatestage
end if
end
on getPropertyDescriptionList me
set description = [:]
addProp description, #pNoHilite, [#comment: "No Hilite on rollover", #format: #boolean, #default: 0]
addProp description, #pChangeCursor, [#comment: "Change cursor", #format: #boolean, #default: 1]
addProp description, #pUpstate, [#comment: "State of button on mouseUp", #format: #symbol, #default: #hiL, #range:[#std, #hiL, #dwn, #sel, #ict, #none]]
addProp description, #pLeaveState, [#comment: "State of button on mouseLeave", #format: #symbol, #default: #std, #range:[#std, #hiL, #dwn, #sel, #ict, #none, #asBefore]]
addProp description, #pIgnoreDontReact, [#comment: "Ignore gDontReact - f.e. if Alert box Ok Button", #format: #boolean, #default: 0]
return description
end